package com.lw.dao;

import com.lw.pojo.User;
import org.mybatis.spring.SqlSessionTemplate;

import java.util.List;

/**
 * @author LW
 * @2020/10/3 14:13
 */
public class UserDaoImpl implements UserDao {

    //我们所有操作，都使用sqlSession来执行（在原来），现在都使用SqlSessionTemplate
    private SqlSessionTemplate sqlSession;

    public void setSqlSession(SqlSessionTemplate sqlSession) {
        this.sqlSession = sqlSession;
    }

    public List<User> queryAll() {
        UserDao mapper = sqlSession.getMapper(UserDao.class);
        return mapper.queryAll();
    }
}
